package com.gjy.pd.observer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2022-12-06 14:44:41
 */
public class ConcreteObserver implements Observer {

    private static final Logger logger = LoggerFactory.getLogger(ConcreteObserver.class);

    private final Observable observable;
    private final String status;

    public ConcreteObserver(Observable observable, String status) {
        this.observable = observable;
        this.status = status;
    }

    @Override
    public void process(Map<String, Object> map) {
        if (!status.equals(observable.getStatus())) {
            logger.error("提供的状态码和注册项目的状态码不同");
            return;
        }
        logger.info("入参: {}", map);
    }

}
